/*******************************************************************************
* Copyright (c) 2010, 2018 西安秦晔信息科技有限公司
* Licensed under the Apache License, Version 2.0 (the "License");
*    you may not use this file except in compliance with the License.
*    You may obtain a copy of the License at
*
*       http://www.apache.org/licenses/LICENSE-2.0
*
*    Unless required by applicable law or agreed to in writing, software
*    distributed under the License is distributed on an "AS IS" BASIS,
*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*    See the License for the specific language governing permissions and
*    limitations under the License.
*******************************************************************************/
package com.qinyeit.serviceapp.entity;

import com.qinyeit.serviceapp.entity.enums.Gender;
import com.qinyeit.serviceapp.entity.enums.State;
import com.qinyeit.serviceapp.entity.system.ManagementAccount;
import com.qinyetech.springstage.core.entity.AbstractEntity;

import javax.persistence.*;
import javax.validation.constraints.NotEmpty;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Builder;
import lombok.experimental.Tolerate;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * ClassName: Employee <br/>
 * Function: 员工 <br/>
 * date: 2018-11-20 13:17:56 <br/>
 *
 * @author liuwenjin
 * @version  1.0
 * @since JDK 1.8
 */
@Builder
@Entity
@Table(name="employees")
public class Employee extends MerchantGroupBaseEntity<Long> {

	private static final long serialVersionUID = 1L;

	// 名称 
    @Column(name="name", length = 300)
	private String name = null;

	// 手机号 
    @Column(name="phone", length = 300)
	private String phone = null;

	// 生日 
	@JSONField(format="yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
    @Column(name="birthday")
	private Date birthday = null;

	// 性别 
    @Column(name="gender", length = 300)
	@Enumerated(EnumType.STRING)
	private Gender gender = null;

	// 头像 
    @Column(name="avatar", length = 300)
	private String avatar = null;

	// 详细地址 
    @Column(name="address", length = 300)
	private String address = null;


	// 区域id 
    @Column(name="district_id")
	private Long districtId = null;

	// 部门id 
    @Column(name="department_id")
	private Long departmentId = null;

    @OneToOne
	@JoinColumn(name="account_id")
	private ManagementAccount account=null;


	// 状态
	@Column(name="state", length = 300)
	@Enumerated(EnumType.STRING)
	private State state = State.NORMAL;

	// 区域id
	@Transient
	private String districtName = null;

	// 部门id
	@Transient
	private String departmentName = null;

	// 操作人
	@Column(name="operator_name")
	private String operatorName = null;

	//	//数据权限串 可管理的门店 [1,2]
	@Column(name="attach_data_permission")
	private String attachDataPermission = "";

	/*// 部门id
	@Transient
	private String position = null;
*/


	@Tolerate
	public Employee() {
		
	}
    @Tolerate
	public Employee(Long id){
    	super.setId(id);
    }
	
	/**
	 * 获取名称
	 */
	public String getName() {
		return this.name;
	}

    /**
     * 设置名称
     */
	public Employee setName(String name) {
		this.name = name;
		return this;
	}

	/**
	 * 获取手机号
	 */
	public String getPhone() {
		return this.phone;
	}

    /**
     * 设置手机号
     */
	public Employee setPhone(String phone) {
		this.phone = phone;
		return this;
	}

	/**
	 * 获取生日
	 */
	public Date getBirthday() {
		return this.birthday;
	}

    /**
     * 设置生日
     */
	public Employee setBirthday(Date birthday) {
		this.birthday = birthday;
		return this;
	}

	public Gender getGender() {
		return gender;
	}

	public void setGender(Gender gender) {
		this.gender = gender;
	}

	/**
	 * 获取头像
	 */
	public String getAvatar() {
		return this.avatar;
	}

    /**
     * 设置头像
     */
	public Employee setAvatar(String avatar) {
		this.avatar = avatar;
		return this;
	}

	/**
	 * 获取详细地址
	 */
	public String getAddress() {
		return this.address;
	}

    /**
     * 设置详细地址
     */
	public Employee setAddress(String address) {
		this.address = address;
		return this;
	}


	/**
	 * 获取区域id
	 */
	public Long getDistrictId() {
		return this.districtId;
	}

    /**
     * 设置区域id
     */
	public Employee setDistrictId(Long districtId) {
		this.districtId = districtId;
		return this;
	}

	/**
	 * 获取部门id
	 */
	public Long getDepartmentId() {
		return this.departmentId;
	}

    /**
     * 设置部门id
     */
	public Employee setDepartmentId(Long departmentId) {
		this.departmentId = departmentId;
		return this;
	}

	public ManagementAccount getAccount() {
		return account;
	}

	public void setAccount(ManagementAccount account) {
		this.account = account;
	}

	public State getState() {
		return state;
	}

	public void setState(State state) {
		this.state = state;
	}

	public String getDistrictName() {
		return districtName;
	}

	public void setDistrictName(String districtName) {
		this.districtName = districtName;
	}

	public String getDepartmentName() {
		return departmentName;
	}

	public void setDepartmentName(String departmentName) {
		this.departmentName = departmentName;
	}

	public String getOperatorName() {
		return operatorName;
	}

	public void setOperatorName(String operatorName) {
		this.operatorName = operatorName;
	}

	public String getAttachDataPermission() {
		return attachDataPermission;
	}

	public void setAttachDataPermission(String attachDataPermission) {
		this.attachDataPermission = attachDataPermission;
	}
}
